/**
  * @file JsonFileWriter.h
  * @author Thibault Merle et Guillaume Poussel
  */
#ifndef _JSON_FILE_WRITER_H_
#define _JSON_FILE_WRITER_H_

#include <iostream>
#include "io/FileWriter.h"

/**
  * Classe qui écrit les résultats au format JSON :
  * @verbatim
  {
   'points': [
     {'x':0, 'y':0},
     {'x':1, 'y':5},
     ...
   ],
   'envelop': [
     {'x':0, 'y':0},
     {'x':1, 'y':5},
     ...
   ]
  } @endverbatim
  */
class JsonFileWriter : public FileWriter {
public:
    JsonFileWriter(const char* filename) : FileWriter(filename) {};
    virtual void write(const point_list points, const point_list hull) const;
private:
    void write_point(std::ostream& out, const Point* pt) const;
    void write_points(std::ostream& out, const point_list points) const;
};

#endif
